import { GET_SHOWLISTTABA_DATA, GET_SHOWLISTACON_DATA } from "./actionType";

const loadShowListtabaData = val => {
  return {
    type: GET_SHOWLISTTABA_DATA,
    val
  };
};

const loadShowListaconData = val => {
  return {
    type: GET_SHOWLISTACON_DATA,
    val
  };
};
var poxy = "/apis";
//列表 刘杰
// /Show/Search/getShowList?category=35&city_id=0&page=1&keywords=&version=6.0.8&referer=2
export const loadShowListtabaDataAysnc = (dispatch, params, fn) => {
  fetch(
    poxy +
      `/Show/Search/getShowList?category=${params.category}&city_id=${params.city_id}&page=${params.page}&keywords=&version=6.0.8&referer=2`,
    {
      method: "GET"
    }
  )
    .then(data => {
      return data.json();
    })
    .then(res => {
      var val = res.data.list;
      fn();
      if (params.status === "concat") {
        dispatch(loadShowListaconData(val));
      } else {
        dispatch(loadShowListtabaData(val));
      }
    });
};
